package com.eugene.entity;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;

import com.eugene.element.FnCalendar;
import com.eugene.enums.EMaturity;
import com.eugene.interfaces.Calculable;

/** 
 * Class for Data Transfer from DB to Application and from Application to DB
 * There are no functionality except Data Transfer
*/
public class CommonEntity implements Serializable, Calculable{
	private String etyId;
	private String etyName;
	private String etyAlias;
	private String etyDesc;
	private EMaturity maturity;
	
	private FnCalendar baseDate;
	private FnCalendar fwdDate;
	private double primaryValue;
	private double secondaryValue;
	private double derivedValue;
	private int intValue;
	private int count;
	private int index;
	private boolean flag;
//	private Calendar lastUpdate;
	private Date lastUpdate;
	
	public CommonEntity(){
	}
	public CommonEntity(String etyId){
		this.etyId =etyId;
	}
	public CommonEntity(String etyId, String etyName){
		this.etyId = etyId;
		this.etyName = etyName;
	}
	public CommonEntity(String etyId, String etyName, String etyAlias){
		this.etyId = etyId;
		this.etyName = etyName;
		this.etyAlias = etyAlias;
	}
	/**
	 * @return the etyId
	 */
	public String getEtyId() {
		return etyId;
	}
	/**
	 * @param etyId the etyId to set
	 */
	public void setEtyId(String etyId) {
		this.etyId = etyId;
	}
	/**
	 * @return the etyName
	 */
	public String getEtyName() {
		return etyName;
	}
	/**
	 * @param etyName the etyName to set
	 */
	public void setEtyName(String etyName) {
		this.etyName = etyName;
	}
	/**
	 * @return the etyAlias
	 */
	public String getEtyAlias() {
		return etyAlias;
	}
	/**
	 * @param etyAlias the etyAlias to set
	 */
	public void setEtyAlias(String etyAlias) {
		this.etyAlias = etyAlias;
	}
	/**
	 * @return the etyDesc
	 */
	public String getEtyDesc() {
		return etyDesc;
	}
	/**
	 * @param etyDesc the etyDesc to set
	 */
	public void setEtyDesc(String etyDesc) {
		this.etyDesc = etyDesc;
	}
	/**
	 * @return the maturity
	 */
	public EMaturity getMaturity() {
		return maturity;
	}
	/**
	 * @param maturity the maturity to set
	 */
	public void setMaturity(EMaturity maturity) {
		this.maturity = maturity;
	}
	/**
	 * @return the baseDate
	 */
	public FnCalendar getBaseDate() {
		return baseDate;
	}
	/**
	 * @param baseDate the baseDate to set
	 */
	public void setBaseDate(FnCalendar baseDate) {
		this.baseDate = baseDate;
	}
	/**
	 * @return the fwdDate
	 */
	public FnCalendar getFwdDate() {
		return fwdDate;
	}
	/**
	 * @param fwdDate the fwdDate to set
	 */
	public void setFwdDate(FnCalendar fwdDate) {
		this.fwdDate = fwdDate;
	}
	/**
	 * @return the primaryValue
	 */
	public double getPrimaryValue() {
		return primaryValue;
	}
	/**
	 * @param primaryValue the primaryValue to set
	 */
	public void setPrimaryValue(double primaryValue) {
		this.primaryValue = primaryValue;
	}
	/**
	 * @return the secondaryValue
	 */
	public double getSecondaryValue() {
		return secondaryValue;
	}
	/**
	 * @param secondaryValue the secondaryValue to set
	 */
	public void setSecondaryValue(double secondaryValue) {
		this.secondaryValue = secondaryValue;
	}
	/**
	 * @return the derivedValue
	 */
	public double getDerivedValue() {
		return derivedValue;
	}
	/**
	 * @param derivedValue the derivedValue to set
	 */
	public void setDerivedValue(double derivedValue) {
		this.derivedValue = derivedValue;
	}
	/**
	 * @return the intValue
	 */
	public int getIntValue() {
		return intValue;
	}
	/**
	 * @param intValue the intValue to set
	 */
	public void setIntValue(int intValue) {
		this.intValue = intValue;
	}
	/**
	 * @return the count
	 */
	public int getCount() {
		return count;
	}
	/**
	 * @param count the count to set
	 */
	public void setCount(int count) {
		this.count = count;
	}
	/**
	 * @return the index
	 */
	public int getIndex() {
		return index;
	}
	/**
	 * @param index the index to set
	 */
	public void setIndex(int index) {
		this.index = index;
	}
	/**
	 * @return the flag
	 */
	public boolean isFlag() {
		return flag;
	}
	/**
	 * @param flag the flag to set
	 */
	public void setFlag(boolean flag) {
		this.flag = flag;
	}

//	/**
//	 * @return the lastUpdate
//	 */
//	public Calendar getLastUpdate() {
//		return lastUpdate;
//	}
//	/**
//	 * @param lastUpdate the lastUpdate to set
//	 */
//	public void setLastUpdate(Calendar lastUpdate) {
//		this.lastUpdate = lastUpdate;
//	}
	/**
	 * @return the lastUpdate
	 */
	public Date getLastUpdate() {
		return lastUpdate;
	}
	/**
	 * @param lastUpdate the lastUpdate to set
	 */
	public void setLastUpdate(Date lastUpdate) {
		this.lastUpdate = lastUpdate;
	}
	@Override
	public boolean equals(Object other){
		return super.equals(other); 
	}
	@Override
	public int hashCode(){
		return super.hashCode();
	}
	@Override
	public double getValue(){
		return primaryValue;
	}
//	@Override
//	public double getDerivedValue(){
//		return 0.0;
//	}
	@Override
	public void setValue(double value){
		primaryValue = value;
	}
	@Override
	public double getDifferFrom(Calculable other){
		return this.getValue() - other.getValue();
	}
}
